package cn.wolfcode.trip.base.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
public class Information extends BaseDomain{
    public static final int TYPE_TRAVECOMMENT = 1;
    public static final int TYPE_REPLY = 2;
    public static final int TYPE_TRAVELLIKE = 3;
    //当前用户
    private User user;
    //关联用户
    private User relevantUser;
    //消息的类型
    private Integer type = 1;
    //消息创建时间
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;

    public String typeName(){
        String temp = "游记评论";
        if(type == TYPE_REPLY){
            temp = "回复";
        }else if(type == TYPE_TRAVELLIKE){
            temp = "赞";
        }
        return temp;
    }

}